<?

class admin_model_resource extends admin_model_base {
	
	public function __construct(){
		parent::__construct();
		$this->table = '_resources';
	}
	
	public function selectList(){
		$sql = "select * from ".$this->table ." order by app, controller, action";
		return $this->admin_db->fetchAll($sql);
	}
	
	public function remove($id){
		$sql = "delete from ".$this->table ." where id = &id";
		$params = array('id'=>$id);
		$this->admin_db->query("delete from priv_users where res_id=$id");
		$this->admin_db->query("delete from priv_roles where res_id=$id");
		return $this->admin_db->query($sql, $params);
	}
}